#ifndef __FRIENDSLIST_H__
#define __FRIENDSLIST_H__

#include <QTreeWidget>
#include <QList>

#include "common/status.h"

class Friend;

namespace Ui {

class FriendsItem;

class FriendsList : public QTreeWidget {

Q_OBJECT

public:
	FriendsList(QWidget* _parent);
	~FriendsList();

	int getId(QString _login);
	Friend *getFriend(int friendId);
	void removeFriend(int friendId);
public slots:
	void loadFriends(QList<Friend*> _friends);
	void updateFriend(Friend* _friend);
	void addFriend(Friend* _friend);
private slots:
	void friendDoubleClicked(QTreeWidgetItem *item, int);
signals:
	void startChat(int id);
private:
	QIcon getStatusIcon(Status _status) const;
	QMap<int,FriendsItem*> friends;
	QTreeWidgetItem *on, *off;
};

}

#endif // __FRIENDSLIST_H__

